<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.prime.com.tr/ui">

<h:head>
	<link rel="stylesheet"
		href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css">
	</link>

	<title>All users</title>
</h:head>

<h:body>

	<div class="navbar navbar-inverse">
		<div class="navbar-inner">
			<div class="container-fluid">
				<a class="btn btn-navbar" data-toggle="collapse"
					data-target=".nav-collapse"> <span class="icon-bar"></span> <span
					class="icon-bar"></span> <span class="icon-bar"></span>
				</a> <a class="brand" href="faces/activities.xhtml" name="top">Activity
					planner</a>
				<div class="nav-collapse collapse">
					<ul class="nav">

						<li><a href="login.xhtml"> Login </a></li>
						<li class="divider-vertical"></li>
						<li><a href="userlist.xhtml"> User list </a></li>
						<li class="divider-vertical"></li>
						<li><a href="edituser.xhtml"> Your profile </a></li>
						<li class="divider-vertical"></li>
					</ul>
					<div class="btn-group pull-right">
						<a class="btn dropdown-toggle" data-toggle="dropdown" href="login.xhtml">
							<i class="icon-user"></i> Hello, #{userBean.currentUser.name}!
							<span class="caret"></span>
						</a>
						<ul class="dropdown-menu">
							<li><a href="#"><i class="icon-wrench"></i> Settings</a></li>
							<li class="divider"></li>
							<li><a href="#"><i class="icon-share"></i> User list</a></li>
						</ul>
					</div>
				</div>
				<!--/.nav-collapse -->
			</div>
			<!--/.container-fluid -->
		</div>
		<!--/.navbar-inner -->
	</div>
	<!--/.navbar -->

	<h:panelGroup id="dynaFormGroup">
		<p:messages id="messages" showSummary="true" />

	</h:panelGroup>

	<h:form class="text-info">
		<table>
			<tr>
				<td><label path="login"> Login </label></td>
				<td><h:inputText id="login"
						value="#{userBean.login}" size="20" required="true"
						label="Login">
					</h:inputText></td>
			</tr>
			<tr>
				<td><label path="password"> Password </label></td>
				<td><h:inputSecret id="password"
						value="#{userBean.password}" size="20" required="false"
						label="Password">
						</h:inputSecret></td>
			</tr>
			<tr>
				<td><label path="name"> Name </label></td>
				<td><h:inputText id="name" value="#{userBean.name}"
						size="20" required="false" label="Name">
					</h:inputText></td>
			</tr>
			<tr>
				<td><label path="email"> Email </label></td>
				<td><h:inputText id="email"
						value="#{userBean.email}" size="20" required="false"
						label="Email">
					</h:inputText></td>
			</tr>
			<tr>
				<td><label path="role"> Role </label></td>
				<td><h:inputText id="role"
						value="#{userBean.role}" size="20" required="false"
						label="Role">
					</h:inputText></td>
			</tr>
			<tr>
				<td><label path="status"> Status </label></td>
				<td><h:inputText id="status"
						value="#{userBean.status}" size="20" required="false"
						label="Status">
					</h:inputText></td>
			</tr>

		</table>

		<h:commandButton value="Add user" class="btn-info btn"
			action="#{userBean.addAction()}" />

	</h:form>

	<h:form class="text-info" method="post">
		<h2>All users</h2>
		<h:dataTable border="1" value="#{userBean.listAllUsers}" var="o">

			<h:column>
				<f:facet name="header">Login</f:facet>
				<h:outputText value="#{o.login}" />
			</h:column>
			<h:column>
				<f:facet name="header">Name</f:facet>
				<h:outputText value="#{o.name}" />
			</h:column>
			<h:column>
				<f:facet name="header">Email</f:facet>
				<h:outputText value="#{o.email}" />
			</h:column>
			<h:column>
				<f:facet name="header">Role</f:facet>
				<h:outputText value="#{o.role}" />
			</h:column>
			<h:column>
				<f:facet name="header">Status</f:facet>
				<h:outputText value="#{o.status}" />
			</h:column>

			<h:column>
				<h:commandLink value="Edit" action="#{userBean.editAction(o)}" />
			</h:column>

			<h:column>
				<h:commandLink value="Delete"
					action="#{userBean.deleteAction(o.id)}" />
			</h:column>

		</h:dataTable>

	</h:form>

</h:body>

</html>